home *** CD-ROM | disk | FTP | other *** search
- /*
- pronet-page.c
-
- */
-
- #include <string.h>
-
- #include <exec/exec.h>
- #include <devices/pronet.h>
-
- #include <proto/exec.h>
- #include <proto/alib.h>
-
- char verstring[] = "$VER: pronet-page 37.0 (30.11.96)";
-
- void __chkabort(void) {} /* Disable CTRL-C handling */
-
- static ULONG unit = 0;
- static struct PNRequest *pronetio;
- static struct MsgPort *pronetport, *pronetport2;
-
- #define ACTION_PAGE 19941996
-
- int main(ULONG argc, char *argv[])
- {
- ULONG RC = 20;
- BYTE pronetopen;
- char string[260];
-
- if(argc==3)
- {
- unit = atoi(argv[1]);
- strncpy(&string[4], argv[2], 255);
- string[259] = '\0';
- ((ULONG*)string)[0] = ACTION_PAGE;
-
- if(pronetport2 = CreateMsgPort())
- {
- if(pronetio = (struct PNRequest*)CreateIORequest(pronetport2,sizeof(struct PNRequest)))
- {
- if(pronetport = CreateMsgPort())
- {
- pronetio->pnr_NetSourcePort = PNP_NEXTFREE;
- pronetio->pnr_MsgPort = pronetport;
- pronetio->pnr_Data = &string;
-
- if(!(pronetopen = OpenDevice("pronet.device",unit,(struct IORequest*)pronetio,PNF_ERRORSTRING)))
- {
- pronetio->pnr_Request.io_Command = CMD_WRITE;
- pronetio->pnr_Data = &string;
- pronetio->pnr_Length = 260;
- pronetio->pnr_NetDestPort = 0;
- DoIO((struct IORequest*)pronetio);
-
- RC = 0;
- CloseDevice((struct IORequest*)pronetio);
- }
- else switch(pronetopen)
- {
- case PNDERR_UNIT_NOT_DEFINED:
- Printf("Unit %ld not defined.\n",unit);
- break;
-
- case PNDERR_DRIVERTROUBLE:
- Printf("Driver trouble: %s\n",&string);
- break;
-
- default:
- Printf("Couldn't open pronet.device.\n");
- break;
- }
- DeleteMsgPort(pronetport);
- }
- DeleteIORequest((struct IORequest*)pronetio);
- }
- DeleteMsgPort(pronetport2);
- }
- }
- else
- Printf("Usage: pronet-page {Unit} \"{Text}\", e.g.\n pronet-page 0 \"Hello, world!\"\n");
-
- return(RC);
- }
-